package com.slipper.common.bo;

import java.io.Serializable;
import java.util.Date;

import org.springframework.format.annotation.DateTimeFormat;

import com.slipper.common.gson.GsonExclude;
import com.slipper.common.util.Tool;

public class CommonBO implements Serializable {
    private static final long serialVersionUID = -5557300297741562335L;

    /** 页索引 */
    @GsonExclude
    private int pageNumber;

    /** 每页行数 */
    @GsonExclude
    private int pageSize;

    /** 查询开始时间 */
    @GsonExclude
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date startDate;

    /** 查询结束时间 */
    @GsonExclude
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endDate;

    /** 查询开始时间，字符串 */
    @GsonExclude
    private String startDateStr;

    /** 查询结束时间，字符串 */
    @GsonExclude
    private String endDateStr;

    /** 查询开始时间，字符串 */
    @GsonExclude
    private Integer startDateInt;

    /** 查询结束时间，字符串 */
    @GsonExclude
    private Integer endDateInt;

    /** 排序字段 */
    @GsonExclude
    private String sortField;

    @GsonExclude
    private String sourSortField;

    /** 排序类型 */
    @GsonExclude
    private String sortType;
    
    /** 更新人 */
    @GsonExclude
    private String updateId;

    /** 创建人 */
    @GsonExclude
    private String createId;

    /** 创建人 */
    @GsonExclude
    private String createName;

    /** 当前登录人ID */
    @GsonExclude
    private String currentEmployeeId;

    /** 当前登录人部门ID */
    @GsonExclude
    private String currentOrgId;

    /** 当前登录人单位ID */
    @GsonExclude
    private String currentUnitId;

    /** 范围查询 */
    @GsonExclude
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date[] dateRange;

    /** 查询类型 */
    @GsonExclude
    private String queryType;

    /** 错误编码 */
    private String errCode;

    /** 错误信息 */
    private String errMessage;

    public int getPageNumber() {
        return pageNumber <= 0 ? 1 : pageNumber;
    }

    public void setPageNumber(int pageNumber) {
        this.pageNumber = pageNumber;
    }

    public int getPageSize() {
        return pageSize <= 0 ? 10 : pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public String getStartDateStr() {
        return startDateStr;
    }

    public void setStartDateStr(String startDateStr) {
        this.startDateStr = startDateStr;
    }

    public String getEndDateStr() {
        return endDateStr;
    }

    public void setEndDateStr(String endDateStr) {
        this.endDateStr = endDateStr;
    }

    public String getSortField() {
        return Tool.changeName(sortField);
    }

    public String getSourSortField() {
        return sourSortField;
    }

    public void setSortField(String sortField) {
        this.sortField = sortField;
        this.sourSortField = sortField;
    }

    public String getSortType() {
        return sortType;
    }

    public void setSortType(String sortType) {
        this.sortType = sortType;
    }

    public String getUpdateId() {
        return updateId;
    }

    public void setUpdateId(String updateId) {
        this.updateId = updateId;
    }

    public String getCreateId() {
        return createId;
    }

    public void setCreateId(String createId) {
        this.createId = createId;
    }

    public String getCreateName() {
        return createName;
    }

    public void setCreateName(String createName) {
        this.createName = createName;
    }

    public String getCurrentEmployeeId() {
        return currentEmployeeId;
    }

    public void setCurrentEmployeeId(String currentEmployeeId) {
        this.currentEmployeeId = currentEmployeeId;
    }

    public String getCurrentOrgId() {
        return currentOrgId;
    }

    public void setCurrentOrgId(String currentOrgId) {
        this.currentOrgId = currentOrgId;
    }

    public String getCurrentUnitId() {
        return currentUnitId;
    }

    public void setCurrentUnitId(String currentUnitId) {
        this.currentUnitId = currentUnitId;
    }

    public Date[] getDateRange() {
        return dateRange;
    }

    public void setSourSortField(String sourSortField) {
        this.sourSortField = sourSortField;
    }

    public Integer getStartDateInt() {
        return startDateInt;
    }

    public void setStartDateInt(Integer startDateInt) {
        this.startDateInt = startDateInt;
    }

    public Integer getEndDateInt() {
        return endDateInt;
    }

    public void setEndDateInt(Integer endDateInt) {
        this.endDateInt = endDateInt;
    }

    public void setDateRangeInt(Integer[] dateRangeInt) {
        this.startDateInt = dateRangeInt == null ? null : dateRangeInt.length > 0 ? dateRangeInt[0] : null;
        this.endDateInt = dateRangeInt == null ? null : dateRangeInt.length > 1 ? dateRangeInt[1] : null;
    }

    public void setDateRangeStr(String[] dateRangeStr) {
        this.startDateStr = dateRangeStr == null ? null : dateRangeStr.length > 0 ? dateRangeStr[0] : null;
        this.endDateStr = dateRangeStr == null ? null : dateRangeStr.length > 1 ? dateRangeStr[1] : null;
    }

    public void setDateRange(Date[] dateRange) {
        this.dateRange = dateRange;
        this.startDate = dateRange == null ? null : dateRange.length > 0 ? dateRange[0] : null;
        this.endDate = dateRange == null ? null : dateRange.length > 1 ? dateRange[1] : null;
    }

    public String getQueryType() {
        return queryType;
    }

    public void setQueryType(String queryType) {
        this.queryType = queryType;
    }

    public String getErrCode() {
        return errCode;
    }

    public void setErrCode(String errCode) {
        this.errCode = errCode;
    }

    public String getErrMessage() {
        return errMessage;
    }

    public void setErrMessage(String errMessage) {
        this.errMessage = errMessage;
    }
}
